<template>
	<view>
		<u-tabs :list="list" :is-scroll="true" :current="current" @change="change">
		</u-tabs>
		<view style='padding: 5px;'>
			<view v-if='current===0'>
				<coverTable :dataList='dataList'></coverTable>
			</view>
			<view v-if='current===1'>
				<basicTable :dataList='dataList'></basicTable>
			</view>
			<view v-if='current===2'>
				<zcqcTable :dataList='dataList'></zcqcTable>
			</view>
			<view v-if='current===3'>
				<zcqcpyczTable :dataList='dataList'></zcqcpyczTable>
			</view>
			<view v-if='current===4'>
				<zcqcpkTable :dataList='dataList'></zcqcpkTable>
			</view>
			<view v-if='current===5'>
				<pkyyfxTable :dataList='dataList'></pkyyfxTable>
			</view>
		</view>
	</view>
</template>
<script>
	import coverTable from './components/coverTable/index.vue'
	import basicTable from './components/basicTable/index.vue'
	import zcqcTable from './components/zcqcTable/index.vue'
	import zcqcpyczTable from './components/zcqcpyczTable/index.vue'
	import zcqcpkTable from './components/zcqcpkTable/index.vue'
	import pkyyfxTable from './components/pkyyfxTable/index.vue'
	import {
		getCover,
		getBasic,
		getAdminAssetCheck,
		getAssetProfit,
		getAssetLoss,
		getAnalysis
	} from '@/api/table/index.js'
	export default {
		components: {
			coverTable,
			basicTable,
			zcqcTable,
			zcqcpyczTable,
			zcqcpkTable,
			pkyyfxTable
		},
		props: {
			option: {
				type: Object,
				default: {}
			}
		},
		data() {
			return {
				dataList: [],
				list: [{
						name: '封面'
					}, {
						name: '基本情况表'
					}, {
						name: '资产清查汇总表',
					},
					{
						name: '资产清查盘盈处置备案表',
					},
					{
						name: '资产清查盘损(亏)申请处置审批表',
					},
					{
						name: '盘亏原因分析表',
					}
				],
				current: 0
			}
		},
		created() {
			this.getCover();
		},
		methods: {
			//获取封面数据
			getCover() {
				this.dataList = []
				getCover({
					'formGuid': this.option.bizKey
				}).then(res => {
					if (res.success) {
						this.dataList.push(res.data)
					} else {}
				})
			},
			// 获取基本信息情况表
			getBasic() {
				this.dataList = []
				getBasic({
					'formGuid': this.option.bizKey
				}).then(res => {
					if (res.success) {
						this.dataList.push(res.data)
						// eslint-disable-next-line no-empty
					} else {}
				})
			},
			// 获取资产清查汇总表
			getAdminAssetCheck() {
				this.dataList = []
				getAdminAssetCheck({
					'formGuid': this.option.bizKey
				}).then(res => {
					if (res.success) {
						this.dataList = res.data
						// eslint-disable-next-line no-empty
					} else {}
				})
			},
			// 富阳行政事业单位资产清查盘盈处置备案表
			getAssetProfit() {
				this.dataList = []
				getAssetProfit({
					'formGuid': this.option.bizKey
				}).then(res => {
					if (res.success) {
						this.dataList = res.data
						// eslint-disable-next-line no-empty
					} else {}
				})
			},
			// 盘亏
			getAssetLoss() {
				this.dataList = []
				getAssetLoss({
					'formGuid': this.option.bizKey
				}).then(res => {
					if (res.success) {
						this.dataList = res.data
						// eslint-disable-next-line no-empty
					} else {}
				})
			},
			//盘亏分析
			getAnalysis() {
				this.dataList = []
				getAnalysis({
					'formGuid': this.option.bizKey
				}).then(res => {
					if (res.success) {
						this.dataList = res.data
						// eslint-disable-next-line no-empty
					} else {}
				})
			},
			change(index) {
				this.current = index;
				if (index === 0) {
					this.getCover()
				} else if (index === 1) {
					this.getBasic()
				} else if (index === 2) {
					this.getAdminAssetCheck()
				} else if (index === 3) {
					this.getAssetProfit()
				} else if (index === 4) {
					this.getAssetLoss()
				} else if (index === 5) {
					this.getAnalysis()
				}
			}
		}
	}
</script>

<style>
</style>
